package com.topnav.mc.admin.dao.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.topnav.mc.admin.entity.Authorization;
import com.topnav.mc.admin.entity.bean.AuthorizationBean;
import com.topnav.mc.admin.entity.bean.DeviceFavoriteBean;
import com.topnav.mc.admin.entity.param.AuthorizationParam;
import com.topnav.mc.admin.entity.param.DeviceFavoriteParam;
import com.topnav.mc.base.mc.McMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author: kenny
 * @Date: 2024/2/27 9:54
 */
@Mapper
public interface AuthorizationMapper extends McMapper<Authorization, AuthorizationBean, AuthorizationParam> {
    String commSql = " SELECT a.*,p.at_code AS parentCode,p.at_name AS parentName " +
            " FROM mc_auth a " +
            " LEFT JOIN mc_auth p ON a.parent_id = p.id " +
            " ${ew.customSqlSegment} ";
    @Select(commSql)
    AuthorizationBean selectInfoOne(@Param(Constants.WRAPPER) Wrapper queryWrapper);

    @Select(commSql)
    List<AuthorizationBean> selectInfoList(@Param(Constants.WRAPPER) Wrapper queryWrapper);

    @Select(commSql)
    Page<AuthorizationBean> selectInfoPage(Page<AuthorizationParam> page, @Param(Constants.WRAPPER) Wrapper queryWrapper);
}
